<?php
namespace Generator;
use \Exception;
use \Inflector\Base as Inflector;
/**
 * Generates a scaffold for the given model and fields
 * 
 * Example:
 * <code>
 *   php scripts\generate.php static_scaffold <Model> "<field>:<type> <field>:<type> <field>:<type>..."
 * </code>
 * @author vasquezr
 *
 */
class Rbac extends Base {
  public function commands() {
    $this->template_root       = dirname(__FILE__).'/templates';
    $this->app_root            = getcwd();

    
    $this->controller_path     = $this->app_root.'/application/controllers';
    $this->helper_path         = $this->app_root.'/application/helpers';  
    $this->model_path          = $this->app_root.'/application/models';
    $this->view_path           = $this->app_root.'/application/views';

    $this->directory($this->controller_path);
    $this->directory($this->helper_path);
    $this->directory($this->model_path);
    $this->directory($this->view_path);
    $this->directory($this->view_path.'/notification_mailer');
    $this->directory($this->view_path.'/permission');
    $this->directory($this->view_path.'/role');
    $this->directory($this->view_path.'/user');
    
    /* Controllers */
    $this->file(
      $this->template_root.'/controllers/permission_controller.php'
     ,$this->controller_path.'/permission_controller.php'
    );
    
    $this->file(
      $this->template_root.'/controllers/role_controller.php'
     ,$this->controller_path.'/role_controller.php'
    );
    
    $this->file(
      $this->template_root.'/controllers/user_controller.php'
     ,$this->controller_path.'/user_controller.php'
    );
    
    /* Helpers */
    $this->file(
      $this->template_root.'/helpers/notification_mailer_helpers.php'
     ,$this->helper_path.'/notification_mailer_helpers.php'
    );
    
    $this->file(
      $this->template_root.'/helpers/permission_helpers.php'
     ,$this->helper_path.'/permission_helpers.php'
    );
    
    $this->file(
      $this->template_root.'/helpers/role_helpers.php'
     ,$this->helper_path.'/role_helpers.php'
    );
    
    $this->file(
      $this->template_root.'/helpers/user_helpers.php'
     ,$this->helper_path.'/user_helpers.php'
    );
    
    /* Models */
    $this->file(
      $this->template_root.'/models/notification_mailer.php'
     ,$this->model_path.'/notification_mailer.php'
    );
    
    $this->file(
      $this->template_root.'/models/permission.php'
     ,$this->model_path.'/permission.php'
    );
    
    $this->file(
      $this->template_root.'/models/role_permission.php'
     ,$this->model_path.'/role_permission.php'
    );
    
    $this->file(
      $this->template_root.'/models/role.php'
     ,$this->model_path.'/role.php'
    );
    
    $this->file(
      $this->template_root.'/models/user_role.php'
     ,$this->model_path.'/user_role.php'
    );
    
    $this->file(
      $this->template_root.'/models/user.php'
     ,$this->model_path.'/user.php'
    );
    
    /* Views */
    $this->file(
      $this->template_root.'/views/notification_mailer/forgot_password.xhtml.php'
     ,$this->view_path.'/notification_mailer/forgot_password.xhtml.php'
    );
    
    $this->file(
      $this->template_root.'/views/permission/_form.xhtml.php'
     ,$this->view_path.'/permission/_form.xhtml.php'
    );
    
    $this->file(
      $this->template_root.'/views/permission/add.xhtml.php'
     ,$this->view_path.'/permission/add.xhtml.php'
    );
    
    $this->file(
      $this->template_root.'/views/permission/edit.xhtml.php'
     ,$this->view_path.'/permission/edit.xhtml.php'
    );
    
    $this->file(
      $this->template_root.'/views/permission/enlist.xhtml.php'
     ,$this->view_path.'/permission/enlist.xhtml.php'
    );
    
    $this->file(
      $this->template_root.'/views/permission/view.xhtml.php'
     ,$this->view_path.'/permission/view.xhtml.php'
    );
    
    $this->file(
      $this->template_root.'/views/role/_form.xhtml.php'
     ,$this->view_path.'/role/_form.xhtml.php'
    );
    
    $this->file(
      $this->template_root.'/views/role/add.xhtml.php'
     ,$this->view_path.'/role/add.xhtml.php'
    );
    
    $this->file(
      $this->template_root.'/views/role/edit.xhtml.php'
     ,$this->view_path.'/role/edit.xhtml.php'
    );
    
    $this->file(
      $this->template_root.'/views/role/enlist.xhtml.php'
     ,$this->view_path.'/role/enlist.xhtml.php'
    );
    
    $this->file(
      $this->template_root.'/views/role/view.xhtml.php'
     ,$this->view_path.'/role/view.xhtml.php'
    );
    
    $this->file(
      $this->template_root.'/views/user/_form.xhtml.php'
     ,$this->view_path.'/user/_form.xhtml.php'
    );
    
    $this->file(
      $this->template_root.'/views/user/add.xhtml.php'
     ,$this->view_path.'/user/add.xhtml.php'
    );
    
    $this->file(
      $this->template_root.'/views/user/edit.xhtml.php'
     ,$this->view_path.'/user/edit.xhtml.php'
    );
    
    $this->file(
      $this->template_root.'/views/user/enlist.xhtml.php'
     ,$this->view_path.'/user/enlist.xhtml.php'
    );
     
    $this->file(
      $this->template_root.'/views/user/forgot_password.xhtml.php'
     ,$this->view_path.'/user/forgot_password.xhtml.php'
    );
    
    $this->file(
      $this->template_root.'/views/user/login.xhtml.php'
     ,$this->view_path.'/user/login.xhtml.php'
    );
    
    $this->file(
      $this->template_root.'/views/user/signup.xhtml.php'
     ,$this->view_path.'/user/signup.xhtml.php'
    );

    $this->file(
      $this->template_root.'/views/user/welcome.xhtml.php'
     ,$this->view_path.'/user/welcome.xhtml.php'
    );
    
    $this->file(
      $this->template_root.'/views/user/view.xhtml.php'
     ,$this->view_path.'/user/view.xhtml.php'
    );
  }  
}